/*
amazon: www.amazon.cn/PISEN-品胜-CRV3-套装-数码相机电池/dp/B004QZBD10/ref=sr_1_2?ie=UTF8&qid=1306986370&sr=8-2
jingdong: http://www.360buy.com/product/383809.html
taobao: http://item.taobao.com/item.htm?id=8655943042
*/

function getItemCode (url, site) {
    var itemId = "123456";
    $.ajax({
        type: "post",
        url: "http://cps.360buy.com/codeservice.aspx",
        dataType: "json",
        async: false,
        data: "url=" + escape(url) + "&tt=4&ref=" + escape(itemId) + "&series=0&st=1&size=0&text=&haslogo=0&hashot=0",
        cache: false,
        success: function(data) {
            alert(data.code);
        }
    });
}

function getItems () {
    var items = localStorage.drItems;
    if (items == undefined || items == "") {
        items = {};
    }
    else {
        items = JSON.parse(items);
    }
    return items;
}

function removeItem(key) {
    var items = getItems();
    delete items[key];
    localStorage.drItems = JSON.stringify(items);
}

function removeAll() {
    return delete localStorage.drItems;
}